package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @param
 * @return
 */
@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询对应的套餐id
     * @param dishIds
     * @return
     */
    /**
     * 查看菜品是否别套餐关联
     * @param dishIds
     * @return
     */
    public List<Long>getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 保存关系
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除关系
     * @param id
     */
    @Delete("delete from setmeal_dish where id=#{id}")
    void deleteBySetmealId(Long id);

    /**
     * 根据id获取套餐中的彩品信息
     * @param id
     * @return
     */
    @Select("select *from sky_take_out.setmeal_dish where id=#{id}")
    List<SetmealDish> getBySetMealId(Long id);
}
